#include "slot.h"
#include "../v4l2/videoframe.h"
#include "../master.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/prctl.h>

void v4l2_viframe_in(void *sender, uint8_t signal, void *recver, void *para)
{
    class VI* p_vi = (class VI*)sender;
    class DISPLAY *p_display = (class DISPLAY*)recver;
    struct video_frame* viframe = (struct video_frame*)para;
    p_display->update(viframe->mmptr[0]);
            timeval start;
            timeval end;
            float dealtime = 0;
            gettimeofday(&start,NULL);
    cout<<"fd_isset time:"<<start.tv_sec<<":"<<start.tv_usec<<endl;

    // v4l2_buffer buf;
    // static int i = 0;
    // if(i == 0){
    //     FILE *file = fopen("my.yuyv","w+");
    //     fwrite(viframe->mmptr[0],p_vi->m_width * p_vi->m_height * 2,1,file);
    //     fclose(file);
    //     i = 1;
    // }

}